<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import ="com.tog.mcapdms.controller.events.TasklistEventResponse" %>
<%@ page import ="com.tog.mcapdms.util.McapdmsKeys" %>
<%@ page import ="com.tog.component.util.Constants" %>
<%@ page import ="com.tog.component.util.SiteGlobal" %>
<%@ page import ="com.tog.component.util.SecurityConstants" %>
<%@ page import ="com.tog.component.util.DateUtil" %>
<%@ page import ="com.tog.component.util.tracer.Debug" %>
<%@ page import ="com.tog.component.tasklist.ejb.*" %>
<%@ page import ="com.tog.component.role.ejb.RoleEJBData" %>
<%@ page import ="com.tog.component.user.ejb.UserEJBData" %>
<%@ page import ="java.util.ArrayList" %>
<%@ page import ="javax.servlet.http.HttpSession" %>
<jsp:useBean id="util" class="com.tog.mcapdms.beans.UtilBean" scope="request" />
<% try {
  if (!util.authorizeMainWindow(request, out)) {
    return;	
  }
   String context = request.getContextPath();
   int intFilter = 0;
   int intSort = 0;
   int patientCount=0;
   int reviewCount=0;
   String sortValue = "";
   String priorSortByValue = "";
   String priorFilterByPtLName = "";
   String filterByPtLName = "";
   int intTasklisttype = 0;
   String taskLabel = "";		// task contains ...
   String taskNumLabel = "";	// outstanding ...
   boolean onerow = true; 	// should be only one row for each patient, except for sort by other, 
   							// and select all sort option
   boolean useSearchLNFilter = false;
   String errorstr="";
   String strSortByTitle = "";
    boolean booPatientFormat = true;
	int tempId=0;
	Debug.println("START");
   UserEJBData userInfo = (UserEJBData)session.getAttribute(Constants.USEROBJECT);
	String us_uk_task_list = "task list"; 		  
   TasklistEventResponse tb = (TasklistEventResponse) session.getAttribute(Constants.REQUEST_TASKLIST);	
	if (tb == null)
  		errorstr = "We are unable to get your " + us_uk_task_list + " at this time. Please try again.";
  	Debug.println("1");	
  	if (request.getParameter("ErrorMsg") != null)
  		errorstr = request.getParameter("ErrorMsg");
  	
  	int ORDnum = 0;						//Outstanding review days
	int LOSnum;
	int REVnum;
	int compReviews = 0;
	int dischargeDayReviews = 0 ;

	LOSnum = tb.getLOSCount(); 		//Calculate total length of stay
	REVnum = tb.getEventCount();	//Calculate total number of review days
    compReviews = tb.getCompReviewCount();

	if (LOSnum != 0)
		ORDnum = (LOSnum - compReviews) +  dischargeDayReviews;
  	
	if (errorstr.equals(""))
  {
  	if (tb != null)
	{
		priorSortByValue = tb.getPriorSortByValue();
		priorFilterByPtLName = tb.getPriorFilterByPtLName();
		
		if (session.getAttribute(Constants.SESSION_SEARCHTASKLIST) != null &&
			session.getAttribute(Constants.SESSION_SEARCHTASKLIST).equals("Y"))
		{
			useSearchLNFilter = true;
		}
			Debug.println("2");
		if (priorSortByValue == null || priorSortByValue.equals(""))
		{
			priorSortByValue = "ALL";
		}
		intTasklisttype = tb.getTasklistType();
		if (tb.isAdmit())
			if (intTasklisttype == Constants.REFTYPEOFTASK_OUTPATIENT)
			{
				taskLabel = tb.getEventCount()>1? " outpatient services":" outpatient service";
				taskNumLabel = "OP Services";
			}
			else if (intTasklisttype == Constants.REFTYPEOFTASK_INPATIENT)
			{
				String us_uk_Admit = "Admit"; 
				taskLabel = tb.getEventCount()>1? " admits":" admit";
				taskNumLabel = us_uk_Admit+"s";
			}else
			{
				taskLabel = tb.getEventCount()>1? " tasks":"task";
				taskNumLabel = "Tasks";
			}	
		else
		{Debug.println("3");
			taskLabel = tb.getEventCount()>1? " reviews":" review";
			taskNumLabel = "Reviews";
		}
	}
	
	if (request.getParameter("filter") != null && 
			!request.getParameter("filter").equals("")) {
		intFilter = Integer.parseInt(request.getParameter("filter"));
	}else if  (session.getAttribute(Constants.SESSION_CURRENT_FILTER) != null) {
       intFilter = ((Integer)session.getAttribute(Constants.SESSION_CURRENT_FILTER )).intValue();
	    
    }else{
	    intFilter = userInfo.getIntUserDaysDefaultID();
	}	
	Debug.println("filter value is "+ intFilter);
	
	if (request.getParameter("sort") != null && 
			!request.getParameter("sort").equals(""))
		intSort = Integer.parseInt(request.getParameter("sort"));
	else if (session.getAttribute(Constants.SESSION_CURRENT_SORT ) != null){
       intSort = ((Integer)session.getAttribute(Constants.SESSION_CURRENT_SORT )).intValue();
    }else{
	  intSort = userInfo.getIntUserSortDefaultID();
	}	
	Debug.println("Tasklis_main.jsp - 121 -Sort is "+intSort);
	if (request.getParameter("sortValue") != null)
		sortValue = request.getParameter("sortValue");
	else if (session.getAttribute(Constants.SESSION_CURRENT_SORTVALUE) != null)
		sortValue =(String)session.getAttribute(Constants.SESSION_CURRENT_SORTVALUE);
	
	
	Debug.println("Tasklis_main.jsp - 131 - Sort value is "+sortValue);
	
	if (intSort != Constants.TLSORTCONFIGREF_PAT && 
		(sortValue.equalsIgnoreCase("All") || sortValue.equals("")))
		onerow = false;
	Debug.println("Tasklis_main.jsp - 139 - tb.getSortBy is :"+tb.getSortBy());
    switch(tb.getSortBy())
    {
		
    	case Constants.TLSORTCONFIGREF_PAT:
    		strSortByTitle = "&nbsp;";
    		break;
    	case Constants.TLSORTCONFIGREF_ATTMD:
    	{	
    		if (tb.isAdmit())
    		{
    			String us_uk_MD = "MD";
    			if (intTasklisttype == Constants.REFTYPEOFTASK_INPATIENT)
    				
    				strSortByTitle = "Admitting " + us_uk_MD;
    			else
    				strSortByTitle = "Initiating " + us_uk_MD ;
    		}
    		else
    		{
    			String us_uk_Attending_Physician_Physician_MD = "Attending MD"; 
	    		strSortByTitle = us_uk_Attending_Physician_Physician_MD;
	    	}
    			
       		booPatientFormat = false;
    		break;
    	}
    	case Constants.TLSORTCONFIGREF_FAC:
    	{
    		if (intTasklisttype == Constants.REFTYPEOFTASK_INPATIENT)
    			strSortByTitle = "Facility";
    		else
    			strSortByTitle = "Tx Site";
    		booPatientFormat = false;
    		break;
        }    		
    	case Constants.TLSORTCONFIGREF_INS:
    		String us_uk_Insurance = "Insurance";
    		strSortByTitle = us_uk_Insurance + " Plan";
        booPatientFormat = false;
    		break;
    	case Constants.TLSORTCONFIGREF_SERV:
    		String us_uk_Service = "Service";
    		strSortByTitle = us_uk_Service;
        booPatientFormat = false;
    		break;
    	case Constants.TLSORTCONFIGREF_FLOOR:
    		String us_uk_Admit_Floor = "Admit Floor";
    		String us_uk_Review_Floor = "Review Floor";
    		if (tb.isAdmit())
    		{
    			strSortByTitle = us_uk_Admit_Floor;
    		}
    		else
    		{
    			strSortByTitle = us_uk_Review_Floor;
    		}
        	booPatientFormat = false;
    		break;
    	case Constants.TLSORTCONFIGREF_REVR:
    		strSortByTitle = "Reviewer";
        booPatientFormat = false;
    		break;
    	/*case Constants.TLSORTCONFIGREF_ADMTDT:
    		strSortByTitle = "Admit Date"; 
        booPatientFormat = false;
    		break;
			case Constants.TLSORTCONFIGREF_REVDT:
    		strSortByTitle = "Review Date";
        booPatientFormat = false;
    		break;*/
			
    	default:
    		strSortByTitle = "&nbsp;";
    		break;
    }
	Debug.println("Tasklis_main.jsp - 212 - booPatientFormat is :"  +booPatientFormat+ " strSortByTitle is : " +strSortByTitle);
	
    } // end if error message != null
    Debug.println("END");
%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><!--US/UK--><TITLE>Task List</TITLE><!--US/UK-->
<meta http-equiv="Expires" CONTENT="0">
  <meta http-equiv="Cache-Control" CONTENT="no-cache">
  <meta http-equiv="Pragma" CONTENT="no-cache">
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<script src="<%=context%>/jsp/scripts/disableRightClick.js"></script>
<script src="<%=context%>/jsp/scripts/TOGUtils.js"></script>
  <%-- use seperate js, since tried put SiteGlobal in js file not stable
	and this way can reduce checking everyrow --%>
	<% Debug.println("SiteGlobal.DATE_FORMAT is "+SiteGlobal.DATE_FORMAT); %>
<% if (SiteGlobal.DATE_FORMAT.equals("dd/MM/yyyy"))
    { %>
    <script src="<%=context%>/jsp/scripts/sorttableddmmyyyy.js"></script>
   <% } else if (SiteGlobal.DATE_FORMAT.equals("MM/dd/yyyy"))
    {%>
    <script src="<%=context%>/jsp/scripts/sorttablemmddyyyy.js"></script>
    <%} else if (SiteGlobal.DATE_FORMAT.equals("yyyy/MM/dd"))
    { %>
    <script src="<%=context%>/jsp/scripts/sorttableyyyymmdd.js"></script>
  <% } %>
    
<link type="text/css" rel="stylesheet" href="<%=context%>/jsp/scripts/tog.css">

<SCRIPT type="text/javascript" language=JavaScript>
 var us_uk_admit = "admit";
 var us_uk_Admit = "Admit";
 
  window.history.forward(1);
function loadFrame(frame,page)
  {
    eval("parent."+frame+".location='"+page+"'");
  }
   <%if (errorstr.equals("")){%>  
  function AddSelectedPats(id,name)
  {
    var optNewOption;
    var flag=0;
    var len = window.parent.topFrame.cmbSelectedPats.length;
    var objId=id;
   
    var dontCheckBoxCheck = false;
    //alert("document.frmTasklist[name].length "+document.frmTasklist[name].length);
    if (document.frmTasklist[name].length == null){
       dontCheckBoxCheck = true;
    }
    //alert("id is "+id+" name is "+name+" dontcheckboxcheck is "+ dontCheckBoxCheck);
    if (len==1)
    {
      window.parent.topFrame.cmbSelectedPats.length = 0;
      optNewOption = document.createElement("option");
      optNewOption.value = -1;
      optNewOption.text = "Select Patient:";
      window.parent.topFrame.cmbSelectedPats.add(optNewOption);
    }
    else
    {
    //alert("label is already fixed");
    }
    
    // check event and already max exists
    if (len > <%=Constants.MAX_SELECTEDPTS%> && document.getElementById(objId).checked)
    {
    	alert("You can only select maximum <%=Constants.MAX_SELECTEDPTS%> patients\n"+
    		" to your selected patients list");
    	document.getElementById(objId).checked = false;	
    	return;
    } else
    {
		var boxCheck = false;
		if (!dontCheckBoxCheck){
		 for (var i=0; i<document.frmTasklist[name].length;i++){
		  if (document.frmTasklist[name][i].checked && 
		  		(document.frmTasklist[name][i].id ==
		    	document.getElementById(objId).id))
		  {
		    boxCheck = true;
		    break;  
		  }
		 } 
		}else{
		  if ((document.getElementById(objId).type == "checkbox") && 
		   document.getElementById(objId).checked){
		   boxCheck = true;
		  }	
		} 
		
		 
	    if ((document.getElementById(objId).type == "checkbox") && 
	       (boxCheck))
	    {
	    	//alert("itiration is " + 1);
	        optNewOption = document.createElement("option");
	        optNewOption.value = document.getElementById(objId).value;
	        optNewOption.text = document.getElementById(objId).name;
	        optNewOption.id = document.getElementById(objId).id;
	
	        for (var j=0; j<window.parent.topFrame.cmbSelectedPats.length; j++)
	        {              
	             if (window.parent.topFrame.cmbSelectedPats.options[j].id==optNewOption.id)
	             {                   
	             flag=1;
	             break;
	             }
	        }
	        if(flag==0)
	        {           
	           window.parent.topFrame.cmbSelectedPats.add(optNewOption);
	        } 
	    }
	   
	    if ((document.getElementById(objId).type == "checkbox") && (document.getElementById(objId).name != "chkSelectAll") && 
	    (!boxCheck))
	    {
	        //alert("uncheck itiration is " + 1);
	        for (var j=0; j<window.parent.topFrame.cmbSelectedPats.length; j++){
	
	             if (window.parent.topFrame.cmbSelectedPats.options[j].id==document.getElementById(objId).id)
	             {
	              
	                window.parent.topFrame.cmbSelectedPats.remove(j);
				   			   
	            }
	            
	        }
	    }
	    
	    sortSelect(window.parent.topFrame.cmbSelectedPats);
	             
	    //Make sure something was added - otherwise put up message
	    window.parent.topFrame.fixEmptyList();
    }
  }
  
// -------------------------------------------------------------------
// sortSelect(select_object)
//   Pass this function a SELECT object and the options will be sorted
//   by their text (display) values
// -------------------------------------------------------------------
function sortSelect(obj) {
	var o = new Array();

  
	if (obj.options==null) { return; }
	
	for (var i=1; i<obj.options.length; i++) {
    
	
      var optNewOption = document.createElement("option");
      optNewOption.value = obj.options[i].value;
      optNewOption.text = obj.options[i].text;
      optNewOption.id = obj.options[i].id;

      o[o.length] = optNewOption;  

    
	}
	if (o.length==0) { return; }
	o = o.sort( 
		function(a,b) { 
			if ((a.text+"") < (b.text+"")) { return -1; }
			if ((a.text+"") > (b.text+"")) { return 1; }
			return 0;
			} 
	 );
   
	 for (var j=1,i=0; i<o.length; i++,j++) {
       obj.options[j].id = o[i].id;
       obj.options[j].text = o[i].text;
       obj.options[j].value = o[i].value;
      
     
	 }
}

  
  function CheckSelectedPats()
  {
  	if (window.parent.topFrame.cmbSelectedPats != null)
    {
      window.parent.topFrame.cmbSelectedPats.selectedIndex=0;
      
      // i==0 is Select Patients, or No Patients selected label
      for (var i=1; i<window.parent.topFrame.cmbSelectedPats.length; i++)
      {
        var found = false;
        for (j=0; j<document.frmTasklist.elements.length && !found; j++)
        {
          if ((document.frmTasklist.elements[j].type == "checkbox"))
          {
            if (window.parent.topFrame.cmbSelectedPats.options[i].id==
            	document.frmTasklist.elements[j].id){             
                document.frmTasklist.elements[j].checked=true;  
                if (<%=onerow%>)
                	found = true;
            } 
          }
		}
        
      }
     
    }
  }

  function LoadPatient(intPatID)
  {
    clearPage();
    parent.leftFrame.clearPageNoMsg();
    loadFrame('leftFrame','<%=context%>/jsp/control/jsp/leftframecontents/pect.jsp?action=getPECT&patientID='+intPatID);
loadFrame('mainFrame','<%=context%>/jsp/control/jsp/mainframecontents/patient_main.jsp?action=getpatient&patientID='+intPatID);
  }

  function LoadAdmit(intAdmitID, intPatID, intEpisodeID,intRefTypeOfTaskID,intOutptCarelevelID)
  {
    clearPage();
    parent.leftFrame.clearPageNoMsg();
    if (intAdmitID > 0){
    	loadFrame('leftFrame','<%=context%>/jsp/control/jsp/leftframecontents/pect.jsp?action=getPECT&patientID='+intPatID+'&episodeID='+intEpisodeID + '&admitID='+intAdmitID);
    } else if (intOutptCarelevelID > 0){
    	loadFrame('leftFrame','<%=context%>/jsp/control/jsp/leftframecontents/pect.jsp?action=getPECT&patientID='+intPatID+'&episodeID='+intEpisodeID + '&outptcarelevelID='+intOutptCarelevelID);
    } 
    
    if (intAdmitID > 0){
      loadFrame('mainFrame','<%=context%>/jsp/control/jsp/mainframecontents/inptadmit_main.jsp?action=getinptadmit&inptadmitID='+intAdmitID+'&patientID='+intPatID);
    }else if (intOutptCarelevelID > 0){
     loadFrame('mainFrame','<%=context%>/jsp/control/jsp/mainframecontents/outptcarelevel_main.jsp?action=getoutptcarelevel&carelevelID='+intOutptCarelevelID+'&patientID='+intPatID + '&disabled=' + 'N');
    }
  }

  function LoadReview(intReviewID, intPatID, strDOB, intAdmitID, intOutptCarelevelID, intEpisodeID,intRefReviewTypeID)
  {
    clearPage();
    parent.leftFrame.clearPageNoMsg();
    if (intRefReviewTypeID == <%=Constants.REVIEWTYPEREF_IN%>){
    	loadFrame('leftFrame','<%=context%>/jsp/control/jsp/leftframecontents/pect.jsp?action=getPECT&patientID='+intPatID+'&admitID='+intAdmitID+'&episodeID='+intEpisodeID);
    }else if (intRefReviewTypeID == <%=Constants.REVIEWTYPEREF_OUT%>){
	 loadFrame('leftFrame','<%=context%>/jsp/control/jsp/leftframecontents/pect.jsp?action=getPECT&patientID='+intPatID+ '&outptcarelevelID='+intOutptCarelevelID+'&episodeID='+intEpisodeID);
    } 
    if (intRefReviewTypeID == <%=Constants.REVIEWTYPEREF_IN%>){
	  loadFrame('mainFrame','<%=context%>/jsp/control/jsp/mainframecontents/inptreview_main.jsp?action=getinptreview&inptreviewId='+intReviewID+'&DOB='+strDOB);
	}else if (intRefReviewTypeID == <%=Constants.REVIEWTYPEREF_OUT%>){
	  loadFrame('mainFrame','<%=context%>/jsp/control/jsp/mainframecontents/outptreview_main.jsp?action=getopreview&outptreviewId='+intReviewID+'&DOB='+strDOB + '&hdnPatientID=' + intPatID);
	}  
  }

function sortValue_change()
{
	window.parent.topFrame.disableLinkWhileLoading();
    
    var sortValue = document.getElementById("sortValue").value;
    clearPage();
	eval("parent.mainFrame.location='tasklist_main.jsp?action=getTaskList&sortValue="+sortValue+
		"&filter=<%=intFilter%>&sort=<%=intSort%>" + "'");
	 
}

function getTasklistByPtLName(lnameStart)
{
	window.parent.topFrame.disableLinkWhileLoading();
    clearPage();
	eval("parent.mainFrame.location='tasklist_main.jsp?action=getTaskList&ptLNameStart="+lnameStart+
			"&filter=<%=intFilter%>&sort=<%=intSort%>" + "'");
}

function getTasklistBySortPtLName(lnameStart)
{
	window.parent.topFrame.disableLinkWhileLoading();
    var sortValue = document.getElementById("sortValue").value;
    clearPage();
	eval("parent.mainFrame.location='tasklist_main.jsp?action=getTaskList&sortValue="+
			sortValue+"&ptLNameStart="+ lnameStart+
			"&filter=<%=intFilter%>&sort=<%=intSort%>" + "'");
}
function getPreviousNextTasklist(linkflag)
{
	<% if (tb.getSearchResults() != null && tb.getSearchResults().size()>0)
	    {
	    	TasklistEJBData tasklistEJBData = null;
	    	tasklistEJBData = (TasklistEJBData)tb.getSearchResults().get(0);
	        patientCount=tasklistEJBData.getPatientCount();
	       	reviewCount=tasklistEJBData.getReviewCount();
	    }%>
	eval("parent.mainFrame.location='tasklist_main.jsp?linkflag="+linkflag+"&action=<%=Constants.TASKLIST_GET_REV%>&ptCount=<%=patientCount%>"+
		"&taskCount=<%=reviewCount%>"+(<%=booPatientFormat%>?"":("&priorSortByValue="+document.getElementById("sortValue").value))+"&isAdmit=<%=tb.isAdmit()%>'");
}
 <% } %>
  function showError()
  {
  	alert("<%=errorstr%>");
  	
  }
  
	function enableAfterLoad()
	{
		try
		{
			parent.leftFrame.defaultCursor();
			parent.topFrame.enableLinkAfterLoading();
		} catch (e)
		{}
	}
	
	
</SCRIPT>
<script language="JavaScript">
/*	function dosort(table, column, skip) {
            var data = []
            if (skip == undefined) skip = 1
            for (var i = skip, l = table.rows.length; i < l; i++) data.push([parseFloat(table.rows[i].cells[column].innerHTML), table.rows[i]])

            data.sort(function(a, b) { return b[0] - a[0]; })

            for (var i = 0, l = data.length; i < l; i++) {
                var row = table.insertRow(skip + i)
                for (var j = 0, m = data[i][1].cells.length; j < m; j++) {
                    var cell = row.insertCell(-1)
                    cell.innerHTML = data[i][1].cells[j].innerHTML
                }
                table.deleteRow(-1)
            }
        }*/
		var Count=0;
    function sortIt(id) {
            if (id == "upimg") {
                document.getElementById('upimg').style.display = 'none';
                document.getElementById('downimg').style.display = 'block';
            }
            else if (id == "downimg") {
                document.getElementById('upimg').style.display = 'block';
                document.getElementById('downimg').style.display = 'none';
            }
            var table = Object;
            var trs = Array;
            var ths = Array;
            table = document.getElementById('rsTable');
            ths = table.getElementsByTagName("th");
            trs = table.tBodies[0].getElementsByTagName("tr");

            for (var i = 1; i < trs.length; i++) {
                table.tBodies[0].insertBefore(trs[i], trs[0]);
            }


        }
</script>
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<% if (!errorstr.equals("")) { %>
<body bgcolor="#ffffff" onLoad="showError();enableAfterLoad()" >
</body>
<% } else { %>
<BODY bgColor=#ffffff onLoad="javascript:CheckSelectedPats();enableAfterLoad()">
<FORM name="frmTasklist" method="post" action="<%=context%>/jsp/control/jsp/mainframecontents/tasklist_main.jsp">
<input type="hidden" name="action" value="">
<input type="hidden" name="filter" value="<%=intFilter%>">
<input type="hidden" name="sort" value="<%=intSort%>">

<table width="700" border="0" cellspacing="2" cellpadding="2">
    <tr align="left"> 
		<td width="700" colspan="2"><b><font size="3"><!--US/UK-->Tasklist<!--US/UK--></font></b></td>
    </tr>
<tr align="left"> 
	<td width=700 colspan=2><font size="2">&nbsp;Your tasklist contains <b><%=tb.getPatientCount()%></b> <%=tb.getPatientCount()>1?"patients":"patient"%> and <b><%=tb.getEventCount()%></b><%=taskLabel%>.</font></td>

   
    </tr>
       
</table>
    <table width="98%" cellspacing="0" cellpadding="5" rowsep="1" style="border-left: #E6F1F7 1px solid; border-top: #E6F1F7 1px solid; border-bottom: hidden; border-right: #E6F1F7 1px solid;">
    <!-- Display the sort options serach pattern -->
		<tr>
		  <% 
		  if (!useSearchLNFilter) {
		  String[] alphabetList = {"A","B","C","D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
									"O", "P", "Q", "R", "S", "T","U","V", "W", "X", "Y", "Z",Constants.ALLPTLNAME_DISPLAY};
		  int lengthAlpha = alphabetList.length;
				
		  	
		  if (booPatientFormat)
	    {%>
			<td width="100%" align="center">
			<% 
			if (tb.getPatientCount()> Constants.TASKLIST_ALLTHRESHOLD)
				lengthAlpha--; // remove All from list if exceeds maximum
			for (int i=0; i<lengthAlpha; i++)
			{	
				if (alphabetList[i].equalsIgnoreCase(priorFilterByPtLName))
				{ %>
					<%=alphabetList[i]%>
			<%  } else { %>
					<a href="javascript:getTasklistByPtLName('<%=alphabetList[i]%>')"><%=alphabetList[i]%> </a>
			 <% } %>
				
      	  <%} %>
      	  </td>
    <%  } else  {%>
			<td width="50%"> 
					Select <%=strSortByTitle%> &nbsp;
				<select id="sortValue" name="sortValue" size="1" class="TOGDropdownLong" style="width:200px" onChange="sortValue_change()">
								 
              <%
                ArrayList dropdownList = new ArrayList();
				if (tb != null)
				{
					dropdownList = tb.getSortOptionResults();
				}
                String tempSortValue = "";
                for (int j=0; j<dropdownList.size(); j++)
                {
                  tempSortValue = (String)dropdownList.get(j);
                  
                  //if (tempSortValue == null)
                  //	tempSortValue = "None";
                  String tempSortValueAsArgument = tempSortValue;
                  if (tempSortValue.indexOf("'")>-1) {
            		 tempSortValueAsArgument = util.replace(tempSortValueAsArgument,"'","\\\'");
             	  }  
               	%>
                  <option value="<%=tempSortValueAsArgument%>" <%=priorSortByValue.equalsIgnoreCase(tempSortValue)?"SELECTED":""%> ><%=tempSortValue%></option>
              <%}
              
              if (tb.getPatientCount() <= Constants.TASKLIST_ALLTHRESHOLD || useSearchLNFilter)
			  { %>
              <option value="All" <%=(priorSortByValue.equalsIgnoreCase("All")||priorSortByValue.equals(""))?"SELECTED":""%>>All</option>
              <% } 
              if (dropdownList.size() == 0) {%>
              <option value="" SELECTED></option>
              <% } %>
              </select>
			</td>
			<td width="50%" align="center">
			<% 
			for (int i=0; i<lengthAlpha; i++)
			{	
				if (alphabetList[i].equalsIgnoreCase(priorFilterByPtLName))
				{ %>
					<%=alphabetList[i]%>
			<%  } else { %>
					<a href="javascript:getTasklistBySortPtLName('<%=alphabetList[i]%>')"><%=alphabetList[i]%> </a>
			 <% } %>
				
      	  <%} %>
      	  </td>
      <%}
      } // end not use search filter
      else
      { 
      	if (!booPatientFormat)
	    {%>
      	<td width="50%"> 
					Select <%=strSortByTitle%> &nbsp;	
				<select id="sortValue" name="sortValue" size="1" class="TOGDropdownLong" style="width:200px" disabled>
				 <option value="All" SELECTED>All</option>
             	</select>
		</td>
      <% }
      }
      %>
    </tr>
	</table>
	<table class="sortable" width="98%" cellspacing="0" id="rsTable" cellpadding="5" rowsep="1" style="border-collapse: collapse; border-color: #E6F1F7; border-left: #E6F1F7 1px solid; border-top:hidden; border-bottom: #E6F1F7 1px solid; border-right: #E6F1F7 1px solid;" rules="rows">
    	
		<!-- Headers for the tasklist results -->
		 
		<thead>
		  <% 
			if (tb.isAdmit() && booPatientFormat)
		  {
			Debug.println("Tasklis_main.jsp - 674 - isAdmit :"+tb.isAdmit()+" booPatientFormat :"+ booPatientFormat );

			%>
			 <%		 
	 if(tb.getSortBy() ==Constants.TLSORTCONFIGREF_PAT)
      {%>	
	  <th align="right" width="5%" bgcolor="#E6F1F7"></th>
      <th align="left" width="25%" bgcolor="#E6F1F7">
	   <table>
                    <tr>
                        <td>
                           <b style="font-size:15px"> Patient Name</b>
                        </td>
                        <td>
                            <img src="<%=context%>/jsp/graphics/up.png" id="upimg" onclick="sortIt(this.id)" style="display:none; width: 15px; height: 15px" />
							  <img src="<%=context%>/jsp/graphics/down.png" id="downimg" onclick="sortIt(this.id)" style="width: 15px; height: 15px" />
                        </td>
                    </tr>
                 
                </table>
	    
	  </th>		
      <th align="center" width="25%" bgcolor="#E6F1F7">Date of Birth</th>
 <th align="left" width="15%" bgcolor="#E6F1F7" ><!--US/UK-->Admit<!--US/UK--> Date</th>
	   <th align="center" width="15%" bgcolor="#E6F1F7">Outstanding <%=taskNumLabel%></th>

	   <%}		 
	else if(tb.getSortBy() ==Constants.TLSORTCONFIGREF_REVDT)
      {%>	
	  <th align="right" width="5%" bgcolor="#E6F1F7"></th>
	   <th align="left" width="25%" bgcolor="#E6F1F7">Patient Name</th>
      <th align="center" width="25%" bgcolor="#E6F1F7">Date of Birth</th>
	   <th align="left" width="15%" bgcolor="#E6F1F7" >
	     <table>
                    <tr>
                        <td>
                           <b style="font-size:15px"> <!--US/UK-->Review<!--US/UK--> Date</b>
                        </td>
                        <td>
                            <img src="<%=context%>/jsp/graphics/up.png" id="upimg" onclick="sortIt(this.id)" style="display:none; width: 15px; height: 15px" />
							  <img src="<%=context%>/jsp/graphics/down.png" id="downimg" onclick="sortIt(this.id)" style="width: 15px; height: 15px" />
                        </td>
                    </tr>
                 
                </table>
	    
	  </th>		
      <th align="center" width="15%" bgcolor="#E6F1F7">Outstanding <%=taskNumLabel%></th>	   
    <%}
	  else {%>
	  <th align="right" width="5%" bgcolor="#E6F1F7"></th>
	   <th align="left" width="25%" bgcolor="#E6F1F7">Patient Name</th>
      <th align="center" width="25%" bgcolor="#E6F1F7">Date of Birth</th>
		  <th align="left" width="15%" bgcolor="#E6F1F7">
		 <table>
                    <tr>
                        <td>
                           <b style="font-size:15px"> <!--US/UK-->Admit<!--US/UK--> Date</b>
                        </td>
                        <td>
                            <img src="<%=context%>/jsp/graphics/up.png" id="upimg" onclick="sortIt(this.id)" style="display:none; width: 15px; height: 15px" />
							  <img src="<%=context%>/jsp/graphics/down.png" id="downimg" onclick="sortIt(this.id)" style="width: 15px; height: 15px" />
                        </td>
                    </tr>
                 
                </table>
      <th align="center" width="15%" bgcolor="#E6F1F7">Outstanding <%=taskNumLabel%></th>
		<%}  
		  %>
	
    <%}  else if (!tb.isAdmit() && booPatientFormat)
		 
      {	
		 Debug.println("Tasklis_main.jsp - 685 - isAdmit :"+tb.isAdmit()+" booPatientFormat :"+ booPatientFormat );
      %>
	   <%		 
	 if(tb.getSortBy() ==Constants.TLSORTCONFIGREF_PAT)
      {%>	
      <th align="right" width="5%" bgcolor="#E6F1F7"></th>
      <th align="left" width="23%" bgcolor="#E6F1F7"><table>
                    <tr>
                        <td>
                           <b style="font-size:15px"> Patient Name</b>
                        </td>
                        <td>
                            <img src="<%=context%>/jsp/graphics/up.png" id="upimg" onclick="sortIt(this.id)" style="display:none; width: 15px; height: 15px" />
							  <img src="<%=context%>/jsp/graphics/down.png" id="downimg" onclick="sortIt(this.id)" style="width: 15px; height: 15px" />
                        </td>
                    </tr>
                 
                </table></th>
      <th align="center" width="14%" bgcolor="#E6F1F7">Date of Birth</th>
	  <th align="left" width="13%" bgcolor="#E6F1F7"><!--US/UK-->Admit<!--US/UK--> Date
	   </th>		
	  <th align="center" width="10%" bgcolor="#E6F1F7"><!--US/UK-->LOC<!--US/UK--></th>
	  <th align="left" width="15%" bgcolor="#E6F1F7">Review Date
	    </th>
      <th align="center" width="5%" bgcolor="#E6F1F7">Outstanding Reviews</th> 
		 <%}		 
	else if(tb.getSortBy() ==Constants.TLSORTCONFIGREF_REVDT)
      {%>	
	  <th align="right" width="5%" bgcolor="#E6F1F7"></th>
	   <th align="left" width="25%" bgcolor="#E6F1F7">Patient Name</th>
      <th align="center" width="25%" bgcolor="#E6F1F7">Date of Birth</th>
	   <th align="left" width="13%" bgcolor="#E6F1F7"><!--US/UK-->Admit<!--US/UK--> Date
	   </th>		
	  <th align="center" width="10%" bgcolor="#E6F1F7"><!--US/UK-->LOC<!--US/UK--></th>
	   <th align="left" width="15%" bgcolor="#E6F1F7" >
	     <table>
                    <tr>
                        <td>
                           <b style="font-size:15px"> <!--US/UK-->Review<!--US/UK--> Date</b>
                        </td>
                        <td>
                            <img src="<%=context%>/jsp/graphics/up.png" id="upimg" onclick="sortIt(this.id)" style="display:none; width: 15px; height: 15px" />
							  <img src="<%=context%>/jsp/graphics/down.png" id="downimg" onclick="sortIt(this.id)" style="width: 15px; height: 15px" />
                        </td>
                    </tr>
                 
                </table>
	    
	  </th>		
      <th align="center" width="15%" bgcolor="#E6F1F7">Outstanding  Reviews</th>	   
    <%}
	  else {%>
	  <th align="right" width="5%" bgcolor="#E6F1F7"></th>
	   <th align="left" width="25%" bgcolor="#E6F1F7">Patient Name</th>
      <th align="center" width="25%" bgcolor="#E6F1F7">Date of Birth</th>
		  <th align="left" width="15%" bgcolor="#E6F1F7">
		 <table>
                    <tr>
                        <td>
                           <b style="font-size:15px"> <!--US/UK-->Admit<!--US/UK--> Date</b>
                        </td>
                        <td>
                            <img src="<%=context%>/jsp/graphics/up.png" id="upimg" onclick="sortIt(this.id)" style="display:none; width: 15px; height: 15px" />
							  <img src="<%=context%>/jsp/graphics/down.png" id="downimg" onclick="sortIt(this.id)" style="width: 15px; height: 15px" />
                        </td>
                    </tr>
                 
                </table></th>
				<th align="center" width="10%" bgcolor="#E6F1F7"><!--US/UK-->LOC<!--US/UK--></th>
	  <th align="left" width="15%" bgcolor="#E6F1F7">Review Date
	    </th>
      <th align="center" width="5%" bgcolor="#E6F1F7">Outstanding Reviews</th> 
     
		<%}  
		  %>
	

      <%}
      else if (tb.isAdmit() && !booPatientFormat)

      {
		  Debug.println("Tasklis_main.jsp - 698 - isAdmit :"+tb.isAdmit()+" booPatientFormat :"+ booPatientFormat );
		  
		  %>
 	    <th align="right" width="5%" bgcolor="#E6F1F7"></th>
      <th align="left" width="20%" bgcolor="#E6F1F7">Patient Name</th>
      <th align="center" width="15%" bgcolor="#E6F1F7">Date of Birth</th>
	  <th align="center" width="20%" bgcolor="#E6F1F7">
<table>

	              <tr>
				  <td><b style="font-size:15px"><%=strSortByTitle%></b></td>
				  <td>
                       
                       
                            <img src="<%=context%>/jsp/graphics/up.png" id="upimg" onclick="sortIt(this.id)" style="display:none; width: 15px; height: 15px" />
							  <img src="<%=context%>/jsp/graphics/down.png" id="downimg" onclick="sortIt(this.id)" style="width: 15px; height: 15px" />
							  </td>
                       
                    </tr>
                 
                </table></th>
	    </th>
	  <th align="left" width="15%" bgcolor="#E6F1F7"><!--US/UK-->Admit<!--US/UK--> Date
	   </th>			
      <th align="center" width="5%" bgcolor="#E6F1F7">Outstanding <%=taskNumLabel%></th>
      <%}
      else {%>
	  <th align="right" width="4%" bgcolor="#E6F1F7"></th>
      <th align="left" width="15%" bgcolor="#E6F1F7">Patient Name</th>		
      <th align="center" width="14%" bgcolor="#E6F1F7">Date of Birth</th>
	  <th align="center" width="10%" bgcolor="#E6F1F7">
	  <table>

	              <tr>
				  <td><b style="font-size:15px"><%=strSortByTitle%></b></td>
				  <td>
                       
                       
                            <img src="<%=context%>/jsp/graphics/up.png" id="upimg" onclick="sortIt(this.id)" style="display:none; width: 15px; height: 15px" />
							  <img src="<%=context%>/jsp/graphics/down.png" id="downimg" onclick="sortIt(this.id)" style="width: 15px; height: 15px" />
							  </td>
                       
                    </tr>
                 
                </table></th>
	  <th align="left" width="12%" bgcolor="#E6F1F7"><!--US/UK-->Admit<!--US/UK--> Date
	    </th>		
	  <th align="center" width="10%" bgcolor="#E6F1F7"><!--US/UK-->LOC<!--US/UK--> </th>	
	  <th align="left" width="15%" bgcolor="#E6F1F7">Review Date
	    </th>
      <th align="center" width="5%" bgcolor="#E6F1F7">Outstanding <%=taskNumLabel%></th>
      <%}%>
    </thead>
	<% 
	String strSortByValue = null;
    String strSortByValueAsArgument = null;
		
  	if (tb.isAdmit())
	{
    if (tb.getSearchResults() != null && tb.getSearchResults().size()>0)
    {
    	TasklistAdmitEJBData tlInfo = null;
    	for (int i=0; i<tb.getSearchResults().size(); i++)
	    {
        	tlInfo = (TasklistAdmitEJBData)tb.getSearchResults().get(i);
        	strSortByValue = tb.getStrSortByValue(tlInfo);
	    	strSortByValueAsArgument = strSortByValue;
        	       
	    	//this code has been put in to handle names with quotes
	  
	        //if (strSortByValue != null){
	           
	           if (strSortByValue.indexOf("'")>-1) {
	             strSortByValueAsArgument = util.replace(strSortByValueAsArgument,"'","\\\'");
	             }  
	        //}else{
	        //    strSortByValueAsArgument = "None";
	        //    strSortByValue = "None";
	       // }
 
	   	
      tempId = tlInfo.getIntPatientID();
      String imageDis="";;       
      if (tlInfo.getStrDischarge().equals("Y")){
      
    	  System.out.println("date"+tlInfo.getStrDischarge()+"date");
    	  Debug.println("date"+tlInfo.getStrDischargeDate()+"date");
    	  imageDis = "<b><i>D</i></b>";
      	}
      else{
      	imageDis = "";}
      
	 if (booPatientFormat)
      { %>
        <tr>
          
          <td align="right"><input type="checkbox" id=<%=tempId%> name="<%=tlInfo.getStrPatientLName()+", "+tlInfo.getStrPatientFName()%>" value="<%=tlInfo.getIntPatientID()%>_<%=tlInfo.getStrDOB()%>_<%=tlInfo.getIntEpisodeID()%>_<%=tb.isAdmit()%>_<%=tlInfo.getIntAdmitID()%>_<%=tlInfo.getOutptCarelevelID()%>" onClick="javascript:AddSelectedPats(this.id,this.name)"></td>
          <td width="195"><a href="javascript:LoadPatient('<%=tlInfo.getIntPatientID()%>')" style="color: #000000"><%=tb.truncLN(tlInfo.getStrPatientLName())+", "+tb.truncFN(tlInfo.getStrPatientFName())%></A></td>
          <td align="center"><%=tlInfo.getStrDOB()%></td>
		  <td align="left"><a href="javascript:LoadAdmit('<%=tlInfo.getIntAdmitID()%>', '<%=tlInfo.getIntPatientID()%>', '<%=tlInfo.getIntEpisodeID()%>', '<%=tlInfo.getIntRefTypeOfTaskID()%>', '<%=tlInfo.getOutptCarelevelID()%>')"><%=tlInfo.getStrAdmitDate()%></A>
&nbsp;<%=imageDis%></td>
          <td align="center"><%=tlInfo.getIntCount()%></td>              
        	
        </tr>
				<%  
        } else { %>
          <tr>
          
          <td align="right"><input type="checkbox" id=<%=tempId%> name="<%=tlInfo.getStrPatientLName()+", "+tlInfo.getStrPatientFName()%>" value="<%=tlInfo.getIntPatientID()%>_<%=tlInfo.getStrDOB()%>_<%=tlInfo.getIntEpisodeID()%>_<%=tb.isAdmit()%>_<%=tlInfo.getIntAdmitID()%>_<%=tlInfo.getOutptCarelevelID()%>" onClick="javascript:AddSelectedPats(this.id, this.name)"></td>
		  <td width="195"><a href="javascript:LoadPatient('<%=tlInfo.getIntPatientID()%>')" style="color: #000000"><%=tb.truncLN(tlInfo.getStrPatientLName())+", "+tb.truncFN(tlInfo.getStrPatientFName())%></A></td>
          <td align="center"><%=tlInfo.getStrDOB()%></td>
          <td align="center"><%=strSortByValue%></td>
		  <td align="left"><a href="javascript:LoadAdmit('<%=tlInfo.getIntAdmitID()%>', '<%=tlInfo.getIntPatientID()%>', '<%=tlInfo.getIntEpisodeID()%>', '<%=tlInfo.getIntRefTypeOfTaskID()%>', '<%=tlInfo.getOutptCarelevelID()%>')"><%=tlInfo.getStrAdmitDate()%></A>
&nbsp;<%=imageDis%></td>
          <td align="center"><%=tlInfo.getIntCount()%></td>              
        	
        </tr>
				<%} //close else
				} // end main for loop
			%>
	<table width="98%">
	<tr>
    <% //Debug.println("For admit Current index is "+tb.getCurrentIndex());
    //Debug.println("list size is "+tb.getSize());
      if  (tb.getCurrentIndex() - Constants.PAGE_SIZE >0) {

      %>
       <td><a href="javascript:getPreviousNextTasklist('p')"><Div disabled style="font-size:9pt">&lt;&nbsp;Previous <%=Constants.PAGE_SIZE%><Div></a></td>
    <%}%> 

     <% 
     if  (tb.getSize() > tb.getCurrentIndex() ) {%>
       <td align="right"><a href="javascript:getPreviousNextTasklist('n')"><Div disabled style="font-size:9pt">Next <%=Constants.PAGE_SIZE%>&nbsp;&gt;</Div></a></td>
      <%}%> 
  </tr>
  </table>
		<%		} //close if that makes sure some data is returned
    		else {%>
				</table>
		    <b>There are no admits in the Tasklist match the selected criteria.</b>
				<%  }
	}
	//Display if Admit style is false
  else
  {
    if (tb.getSearchResults() != null && tb.getSearchResults().size()>0)
    {
		TasklistReviewEJBData tlInfo = null;
		
		for (int i=0; i<tb.getSearchResults().size(); i++)
	    {
          tlInfo = (TasklistReviewEJBData)tb.getSearchResults().get(i);
	      strSortByValue = tb.getStrSortByValue(tlInfo);
	      strSortByValueAsArgument = strSortByValue;
	      //this code has been put in to handle names with quotes
	      //if (strSortByValue != null){
             
             if (strSortByValue.indexOf("'")>-1) {
              strSortByValueAsArgument = util.replace(strSortByValueAsArgument,"'","\\\'");
             }  
          //}else{
          //    strSortByValueAsArgument = "None";
          //    strSortByValue = "None";
          //}
 	     		
      tempId = tlInfo.getIntPatientID();
      String imageDis;       
      if (tlInfo.getStrDischarge().equals("Y")){
      	imageDis = "<b><i>D</i></b>";
      	}
      else{
      	imageDis = "";}
      	
      String imageRev; 
      if (tlInfo.getStrNonQual().equals("Y")){
      	imageRev = "<img src=\"" + context + "/jsp/graphics/redflag.png\">";}
      else{
      	imageRev = "";}
	     
        if (booPatientFormat)
      	{		
      	%>
        <tr>
          <td align="right"><input type="checkbox" id=<%=tempId%> name="<%=tlInfo.getStrPatientLName()+", "+tlInfo.getStrPatientFName()%>" value="<%=tlInfo.getIntPatientID()%>_<%=tlInfo.getStrDOB()%>_<%=tlInfo.getIntEpisodeID()%>_<%=tb.isAdmit()%>_<%=tlInfo.getIntAdmitID()==-1?tlInfo.getOutptCarelevelID():tlInfo.getIntAdmitID()%>_<%=tlInfo.getIntReviewID()%>_<%=tlInfo.getIntRefReviewTypeID()%>" onClick="javascript:AddSelectedPats(this.id,this.name)"></td>
          <td ><a href="javascript:LoadPatient('<%=tlInfo.getIntPatientID()%>')" style="color: #000000"><%=tb.truncLN(tlInfo.getStrPatientLName())+", "+tb.truncFN(tlInfo.getStrPatientFName())%></A></td>
          <td align="center"><%=tlInfo.getStrDOB()%></td>
          <td align="left"><a href="javascript:LoadAdmit('<%=tlInfo.getIntAdmitID()%>', '<%=tlInfo.getIntPatientID()%>', '<%=tlInfo.getIntEpisodeID()%>', '<%=tlInfo.getIntRefReviewTypeID()%>', '<%=tlInfo.getOutptCarelevelID()%>')"><%=tlInfo.getStrAdmitDate()%></A>
          &nbsp;<%=imageDis%></td>
		  <td align="center"><%=tlInfo.getStrLOCAbbr()%></td>
          <td align="left"><a href="javascript:LoadReview('<%=tlInfo.getIntReviewID()%>', '<%=tlInfo.getIntPatientID()%>', '<%=tlInfo.getStrDOB()%>', '<%=tlInfo.getIntAdmitID()%>', '<%=tlInfo.getOutptCarelevelID()%>', '<%=tlInfo.getIntEpisodeID()%>','<%=tlInfo.getIntRefReviewTypeID()%>')"><%=tlInfo.getStrReviewDate()%></A>
&nbsp;<%=imageRev%></td>   
          <td align="center"><%=tlInfo.getIntCount()%></td>
          </tr>
        <% }
        else
				{ 
			Debug.println("Tasklist_main.jsp - 865 - Sort option - booPatientFormat is: "+booPatientFormat+
				"strSortByValue is :"+strSortByValue);
		%>
				<!-- if the Sort option is other than patient -->
          <tr>
          <td align="right"><input type="checkbox" id=<%=tempId%> name="<%=tlInfo.getStrPatientLName()+", "+tlInfo.getStrPatientFName()%>" value="<%=tlInfo.getIntPatientID()%>_<%=tlInfo.getStrDOB()%>_<%=tlInfo.getIntEpisodeID()%>_<%=tb.isAdmit()%>_<%=tlInfo.getIntAdmitID()==-1?tlInfo.getOutptCarelevelID():tlInfo.getIntAdmitID()%>_<%=tlInfo.getIntReviewID()%>_<%=tlInfo.getIntRefReviewTypeID()%>" onClick="javascript:AddSelectedPats(this.id,this.name)"></td>
          <td ><a href="javascript:LoadPatient('<%=tlInfo.getIntPatientID()%>')" style="color: #000000"><%=tb.truncLN(tlInfo.getStrPatientLName())+", "+tb.truncFN(tlInfo.getStrPatientFName())%></A></td>
          <td align="center"><%=tlInfo.getStrDOB()%></td>
		  <td align="center"><%=strSortByValue%></td>
          <td align="left"><a href="javascript:LoadAdmit('<%=tlInfo.getIntAdmitID()%>', '<%=tlInfo.getIntPatientID()%>', '<%=tlInfo.getIntEpisodeID()%>', '<%=tlInfo.getIntRefReviewTypeID()%>', '<%=tlInfo.getOutptCarelevelID()%>')"><%=tlInfo.getStrAdmitDate()%></A>
&nbsp;<%=imageDis%></td>
		  <td align="center"><%=tlInfo.getStrLOCAbbr()%></td>
          <td align="left"><a href="javascript:LoadReview('<%=tlInfo.getIntReviewID()%>', '<%=tlInfo.getIntPatientID()%>', '<%=tlInfo.getStrDOB()%>', '<%=tlInfo.getIntAdmitID()%>', '<%=tlInfo.getOutptCarelevelID()%>', '<%=tlInfo.getIntEpisodeID()%>','<%=tlInfo.getIntRefReviewTypeID()%>')"><%=tlInfo.getStrReviewDate()%></A>
&nbsp;<%=imageRev%></td>   
		  <td align="center"><%=tlInfo.getIntCount()%></td>
          </tr>
					<% } //close else
				} // end main for loop
						%>
		<table width="98%">
	<tr>
    <% //Debug.println("Current index is "+tb.getCurrentIndex());
    //Debug.println("list size is "+tb.getSize());
      if  (tb.getCurrentIndex() - Constants.PAGE_SIZE >0) {

      %>
       <td><a href="javascript:getPreviousNextTasklist('p')"><Div disabled style="font-size:9pt">&lt;&nbsp;Previous <%=Constants.PAGE_SIZE%><Div></a></td>
    <%}%> 

     <% 
     if  (tb.getSize() > tb.getCurrentIndex() ) {%>
       <td align="right"><a href="javascript:getPreviousNextTasklist('n')"><Div disabled style="font-size:9pt">Next <%=Constants.PAGE_SIZE%>&nbsp;&gt;</Div></a></td>
      <%}%> 
  </tr>
  </table>
	<%	} //close if that makes sure some data is returned
    	else {%>
		</table>
		 <b>There are no Reviews in the Tasklist match the selected criteria.</b>
	<%  }
	} //end main if and else %>

</FORM>
</body>
<% } %>
</html>
<% } catch (Exception e) { Debug.severe("Caught exception in tasklist_main.jsp: "+ e.getMessage()); } %>
